package com.tezign.intelligence.mini.dam.aifamilyconsultant.interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author wuzhiwei
 * @team M
 * @owner wuzhiwei
 * @Date 2021/10/15
 */
@Configuration
public class WebInterceptorConfig implements WebMvcConfigurer {

	@Autowired
	private RequestHeaderAutoInterceptor requestHeaderAutoInterceptor;

	@Autowired
	private LoginInterceptor loginInterceptor;

	/**
	 * 拦截器配置
	 */
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(requestHeaderAutoInterceptor)
				.order(0);
		registry.addInterceptor(loginInterceptor).addPathPatterns("/**")
				.excludePathPatterns(
						"/**/public/**",
						"/AIFamilyConsultant/admin/user/login",
						"/AIFamilyConsultant/user/login",
						"/AIFamilyConsultant/user/register",
						"/css/**", "/js/**",
						"/images/**",
						"/swagger-ui/**",
						"/error",
						"/v3/api-docs",
						"/webjars/**",
						"/swagger-resources/**")
				.order(1);
	}
}



